﻿using System;
using System.Globalization;
using System.Windows.Data;

namespace Foundation.Converters
{
    public class FlagConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var flags = (Enum) value;
            var flag = (Enum) parameter;        
            return flags.HasFlag(flag);
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return parameter;
        }
    }
}
